<script setup lang="ts">
	import { useSystemStore } from "@/store/useSystemStore";
	const systemStore = useSystemStore();
	import { onLaunch, onShow, onHide } from "@dcloudio/uni-app";
	import { userInfo } from "@/api/app/index"
	import { useUserInfoStore } from "@/store/useUserInfoStore";
	const userInfoStore = useUserInfoStore();
	import { routers } from "@/api/app/index"

	
	//获取路由
	let getRouters = (): void => {
		routers().then((res: any) => {
			let target = res.data || []
			let { children = [] } = target[0] ? target[0] : {}
			systemStore.setRouters(children)
			setTimeout(() => {
				uni.reLaunch({
					url: '/pages/projectList/index'
				})
			}, 1000)
		})
	}
	onLaunch(() => {
		let obj = uni.getMenuButtonBoundingClientRect()
		let { top, bottom, height } = obj
		systemStore.setMenuButtonBounding({ top, bottom, height })
		userInfo().then(res => {
			let { permissions, user } = res as any
			userInfoStore.setPermissions(permissions)
			userInfoStore.setUserInfo(user)
			getRouters()
		})
	});
	
	onShow(() => {
		
	})
</script>
<style lang="scss">
	@import url('@/iconfont/iconfont.css');
	/*每个页面公共css */
	page, .page-content{
		width: 100%;
		height: 100%;
	}
	@import "uview-plus/index.scss";
</style>